<?php
class CenterController extends MemberController {
    public function indexAction(){}
    public function commentAction(){
        $mid = Request::asget(3,'id',0);
        $page = Request::asget(3,'page',0);
        if($mid == 0){
            return false;
        }else{
            $comment = new CommentModel;
            $list = $comment->where(['mid' => $mid])->limit($page,20)->select();
            $this->_view->comment = $list;
            $this->_view->page = $page;
        }
    }
    public function baseAction(){
        $mid = Request::asget(3,'id',0);
        if(0 === $mid){
            $mid = $this->_request->getParam('id');
            $flag = $this->_request->getParam('flag');
            $this->_view->flag = $flag;
        }else{
            $flag = 'on';
        }
        $model = new MemberModel;
        $info = $model->where(['id'=>$mid])->one();
        $this->_view->info=$info;
    }
    public function changeAction(){
        // Yaf_Dispatcher::getInstance()->disableView();
        $mid = Request::aspost(3,'id',0);
        $sub_name  = Request::aspost(6,'sub_name','');
        $sex = Request::aspost(3,'sex',3);
        $where = ['id'=>$mid];
        $data = [
            'sub_name' => $sub_name,
            'sex' => $sex,
        ];
        $model = new MemberModel;
        $flag = $model->where($where)->update($data);
        $this->forward('base',['id'=>$mid,'flag'=>$flag]);
        return FALSE;
    }
    
}